/**
 * Resourece
 * @ 第一屏 杂项
 */
import { Base } from "@/pixi/base";
class Resourece extends Base {
  Resourece: any[];
  getSprites: any;
  isRendering: boolean;
  position: object | string;
  anchor: object | string;
  constructor() {
    super();
    this.Resourece = [];
    this.getSprites = {};
    this.load();
    this.position = {x: 3902, y: 0};
    // this.position = { x: -300, y: 0 };
    this.anchor = "center";
    this.isRendering = true;
  }
  load() {
    // 遍历资源
    const ResoureceNameList: string[] = [
      "p4-house3",
      "p4-1",
      "p4-bg",
      // "p4-start",
    ];
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      this.Resourece.push({
        name: `${ResoureceNameList[i].replace("-", "")}`,
        url: require(`@/${this.baseUrl}/images/${ResoureceNameList[i]}.png`),
      });
    }
    // 设置精灵
    for (let i = 0; i <= ResoureceNameList.length - 1; i++) {
      console.log(ResoureceNameList[i].replace("-", ""));
      this.getSprites[ResoureceNameList[i].replace("-", "")] = {
        key: `${ResoureceNameList[i].replace("-", "")}`,
        size: { mode: "widthFit", width: 0.5 },
        position: "center",
        anchor: "center",
        alpha: '1',
      };
    }
    this.getSprites.p4house3 = {
      key: `p4house3`,
      size: { mode: "widthFit", width: 0.9 },
      position: { x: 0.41, y: 0 },
      anchor: "top",
      alpha: '1',
    };
    this.getSprites.p41 = {
      key: `p41`,
      size: { mode: "widthFit", width: 0.8 },
      position: { x: 1.25, y: 0.5 },
      anchor: "top",
      alpha: '1',
    };
    this.getSprites.p4bg = {
      key: `p41`,
      size: { mode: "heightFit", height: 1 },
      position: { x: 2.4, y: 0.5 },
      anchor: "center",
      alpha: '1',
    };
  }
}
export default new Resourece();
